package com.example.consult.mapper;

import com.example.consult.model.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface EmployeeMapper {

    @Select("select * from employee where employee_account=#{account} and employee_pwd=#{pwd}")
    public Employee searchByAccountAndPassword(String account,String pwd);

    @Select("select * from employee where authority=#{authority}")
    public List<Employee> searchByAuth(int authority);

    @Insert("insert into employee(employee_name,employee_account,employee_pwd,email,phoneNumber)" +
            "value(#{employee_name},#{employee_account},#{employee_pwd},#{email},#{phoneNumber})")
    public int insert(Employee employee);


    @Select("select satisfy from employee where employee_account=#{employeeAccount}")
    public double getSatisfy(String employeeAccount);

    @Update("update employee set satisfy = #{satisfy}")
    public int setSatisfy(double satisfy);
}
